{extend name="base" /}

{block name="title"}英雄难过美人关{/block}

{block name="resource"}
<style type="text/css">
	.num-bet-content {
		padding: 10px;
		border: 1px dashed #d69595;
		margin: auto;
		margin-bottom: 10px;
	}
	.qb_box {
		margin-bottom: 10px;
	}
	.qb_box > p {
		float: none;
	}
</style>
{/block}

{block name="main"}
	<div class="main">
		<div class="container">
			<div class="qd_box">
				<div class="table_modal">
					<div class="num-bet-content row">
						<div class="col-md-6" style="text-align: center; min-height: 80px; line-height: 40px;">
							{if condition="$showLottery1Log[0]['num'] != 0"}
								<h2>第{$showLottery1Log[0]->getData('create_time')|date="Ymd",###}-{$showLottery1Log[0]['lottery_1_log_id']}期开奖结果：<strong style="color: red;">{$showLottery1Log[0]['num']}</strong></h2>
								<small>每注{$showLottery1Log[0]['each_num_price']}元 最高奖金{$showLottery1Log[0]['high_bonus']} 当期奖池奖金：{$showLottery1Log[0]['current_bonus']}元</small>

							{elseif condition="isset($showLottery1Log[1])"}
								<h2>第{$showLottery1Log[1]->getData('create_time')|date="Ymd",###}-{$showLottery1Log[1]['lottery_1_log_id']}期开奖结果：<strong style="color: red;">{$showLottery1Log[1]['num']}</strong></h2>
								<small>每注{$showLottery1Log[1]['each_num_price']}元 最高奖金{$showLottery1Log[1]['high_bonus']} 当期奖池奖金：{$showLottery1Log[1]['current_bonus']}元</small>

							{else/}
								<h2>第{$showLottery1Log[0]->getData('create_time')|date="Ymd",###}-{$showLottery1Log[0]['lottery_1_log_id']}期开奖结果：<strong style="color: red;">未开奖</strong></h2>
								<small>每注{$showLottery1Log[0]['each_num_price']}元 最高奖金{$showLottery1Log[0]['high_bonus']} 当前奖池奖金：{$showLottery1Log[0]['current_bonus']}元</small>

							{/if}
						</div>
						<div class="col-md-6" style="text-align: center; min-height: 80px; line-height: 40px;">
							<div class="btn_gruop" style="margin: 0;">
								<a href="/game/lottery/one/sale">立即投注</a>
							</div>
							<div>
								{if condition="$showLottery1Log[0]['num'] == 0"}
									<small>正在销售第{$showLottery1Log[0]->getData('create_time')|date="Ymd",###}-{$showLottery1Log[0]['lottery_1_log_id']}期 投注截止 {$showLottery1Log[0]->getData('stop_time')|date="Y-m-d H:i",###}</small>
								{else/}
									<small>本期投注已结束</small>
								{/if}
							</div>
						</div>
					</div>
					{if condition="$showLottery1Log[0]['num'] != 0"}
						{php}
							$userId = \think\Session::get('user_id');
							$numDetail = json_decode($showLottery1Log[0] -> num_detail, true);
						{/php}
						{if condition="isset($numDetail[$userId])"}
							<div class="qb_box clearfix">
								<p>你第{$showLottery1Log[0]->getData('create_time')|date="Ymd",###}-{$showLottery1Log[0]['lottery_1_log_id']}期购买的号码：
									{volist name="numDetail[$userId]" id="num"}
										<strong style="color: red;">{$num}</strong> | 
									{/volist}
								</p>
							</div>
						{/if}
					{elseif condition="isset($showLottery1Log[1])"}
						{php}
							$userId = \think\Session::get('user_id');
							$numDetail = json_decode($showLottery1Log[1] -> num_detail, true);
						{/php}
						{if condition="isset($numDetail[$userId])"}
							<div class="qb_box clearfix">
								<p>你第{$showLottery1Log[1]->getData('create_time')|date="Ymd",###}-{$showLottery1Log[1]['lottery_1_log_id']}期购买的号码：
									{volist name="numDetail[$userId]" id="num"}
										<strong style="color: red;">{$num}</strong> | 
									{/volist}
								</p>
							</div>
						{/if}
					{/if}
					
					<div class="qb_box clearfix">
						<p>
							您的购买进度：{$userLotteryLoading['lottery_1_loading']}%
						</p>
					</div>
	
					<div class="tab_title"><p>开奖记录</p></div>
	
					<div class="qd_table_box">
						<div class="table-responsive">
						  	<table class="table text-center table-bordered">
						    	<tr>
						    		<th>期数</th>
						    		<th>开奖结果</th>
						    		<th>中奖金额</th>
						    		<th>创建时间</th>
						    		<th>开奖时间</th>
						    		<!--<th>详细</th>-->
						    	</tr>
								{volist name="lottery1Logs" id="lottery1Log"}
						    	<tr>
						    		<td>{$lottery1Log->getData('create_time')|date="Ymd",###}-{$lottery1Log['lottery_1_log_id']}</td>
						    		<td>{$lottery1Log['num']}</td>
						    		<td>{$lottery1Log['bonus_price']}</td>
						    		<td>{$lottery1Log['create_time']}</td>
						    		<td>{$lottery1Log['open_time']|date="Y-m-d H:i",###}</td>
						    		<!--<td>{$lottery1Log['lottery_1_log_id']}</td>-->
						    	</tr>
						    	{/volist}
						  	</table>
						</div>
						<nav>{$lottery1Logs->render()}</nav>
					</div>
				</div>
			</div>	
		</div>
	</div>
{/block}